package com.cheng.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cheng.common.exception.CommonException;
import com.cheng.data.entity.SettingInfoEntity;
import com.cheng.data.mapper.SettingInfoMapper;
import com.cheng.data.vo.SettingInfoVO;
import com.cheng.service.SettingInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: ChengJW
 * @date: 2021/12/22 8:44
 * @version: 1.0
 * @description:
 */
@Service
public class SettingInfoServiceImpl implements SettingInfoService {

    private final static Logger log = LoggerFactory.getLogger(SettingInfoServiceImpl.class);

    @Autowired
    private SettingInfoMapper settingInfoMapper;

    /**
    * @author: ChengJW
    * @params: [siRsrv1]
    * @return: java.lang.String
    * @date: 2021/12/22
    * @description: 获取头像路径
    */
    @Override
    public SettingInfoVO getSettingVO(String siRsrv1) throws CommonException {

        QueryWrapper<SettingInfoEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("si_Rsrv1",siRsrv1);
        List<SettingInfoEntity> list = settingInfoMapper.selectList(wrapper);
        if (list != null && list.size() > 0){
            SettingInfoVO settingInfoVO = new SettingInfoVO();
            BeanUtils.copyProperties(list.get(0),settingInfoVO);
            return settingInfoVO;
        }
        return null;
    }
}
